<%
/**
 *  list 组织机构列表
 * 
 * @author  李荣华
 * @version v1.0
 * @date    2017-11-22
 * @since   JSP 2.3.1
 */
%>
<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="at" uri="http://www.jketing.com/at"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>机构列表</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta content="no-cache" http-equiv="Pragma"/>
<meta content="no-cache" http-equiv="Cache-Control"/>
<meta content="0" http-equiv="Expires"/>
<meta name="GENERATOR" content="MSHTML 8.00.6001.18854"/>
<link rel="stylesheet" id="list" type="text/css" href="<at:url css="list.css"/>" />
<link rel="stylesheet" type="text/css" id="banner" href="<at:url css="banner_button.css"/>" />
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/jquery.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/scripts/common.js"></script>
<script type="text/javascript" src="<at:url js="list.js"/>"></script>
<script type="text/javascript" src="<at:url js="banner_button.js"/>"></script>
<script type="text/javascript">
	/**
	 * 跳转到添加页面
	 */
	function add(){
		var url = "${pageContext.request.contextPath }/organ?order=${order}&parentId=${query.parent.id}";
		setTimeout(function(){
		    window.location.href = url;
		},0);
	}
	
	/**
	 * 点击进入编辑页面
	 */
	function enter(id) {
		var url = "${pageContext.request.contextPath}/organ/" + id;
		if (id) {
			if (id != '${rootId}') {
				alert(url);
				$("#_form").attr("action", url);
				$("#_form").submit();
			} else {
				alert('不能修改根节点！');
			}
		}
	}

	/**
	 * 选择进入编辑页面
	 */
	function edit() {
		var id = checkOneValue('checkOne');
		var url = "${pageContext.request.contextPath}/organ/" + id;
		if (id) {
			if (id != '${rootId}') {
				alert(url);
				$("#_form").attr("action", url);
				$("#_form").submit();
			} else {
				alert('不能修改根节点！');
			}
		}
	}
	
	/**
	 * 删除操作
	 */
	function del() {
		var id = checkManyValue('checkOne');
		if (id && window.confirm("你确定要删除吗？")) {
			var url = "${pageContext.request.contextPath }/organ/" + ids;
			$("#_form").attr("action", url);
			$("#_method").val("DELETE");
			$("#_form").submit();
		}
	}
	
	/**
	 * frame内部的数据列表上的查询按钮调用
	 * 
	 * @return
	 */
	function queryBar() {	
		var bar = document.getElementById("query_bar");
		var header = document.getElementById("dataheader");
		var list = document.getElementById("dataList");
		if (bar.style.display == "none") {
			bar.style.display = "block";
			bar.style.top="24px";
			bar.style.height="30px";
			header.style.top="54px";
			list.style.top="78px";
		} else {
			bar.style.display = "none";				
			bar.style.top="0px";
			bar.style.height="0px";				
			header.style.top="24px";
			list.style.top="48px";
		}	
	}
	
	/**
	 * 页面初始化
	 */
	$(document).ready(function(){
		<c:if test="${type!=null}">
			parent.refreshNode(); 
		</c:if>
	});		
</script>
</head>
<body>
	<form action="${pageContext.request.contextPath}/organ/list"
		id="_form" name="queryForm" method="post">
		<input type="hidden" id="_method" name="_method"/>
		<input type="hidden" name="parent.id" value="${query.parent.id}" /> 
		<input type="hidden" name="page" value="${page}" /> 
		<input type="hidden" name="order" value="${order}" /> 
		<input type="hidden" name="vQuery" value="${vQuery}" />	
		<!-- 按钮行表单 -->
		<div class="list1_f">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" >
				<tr>
					<td width="5" height="24" id="kjz03"></td>
					<td class="biao1_zhong" valign="middle">
						<table width="100%" border="0" cellspacing="0"
							cellpadding="0">
							<tr>
								<td height="24">
									<jsp:include page="../../ListHead.jsp" flush="true">
										<jsp:param name="delUrl"
											value="${pageContext.request.contextPath }/organ/" />
									</jsp:include>
								</td>
							</tr>
						</table>
					</td>
					<td width="5" height="24" id="kjy03"></td>
				</tr>
			</table>
		</div>
		<!-- 查询条件（默认不显示） -->
		<div id="query_bar" style="display:${vQuery==0?'none':'block'};" class="queryTab_f">
			<div>机构名称:<input type="text" name="name" value="${query.name}" /></div>
			<div>单位性质:
				<select class="select" name="unitNature.id">
					<option value="" >所有</option>
					<c:forEach items="${unitNature}" var="item">
						<c:choose>
							<c:when test="${query.unitNature.id==item.id}">
						   		<option value="${item.id}" selected='selected'>${item.name}</option>
						   	</c:when> 
						   	<c:otherwise>
						   		<option value="${item.id}">${item.name}</option>
						   	</c:otherwise>  
						</c:choose>
					</c:forEach>
				</select>
			</div>
			<div>隶属关系:
				<select class="select" name="subOrdination.id">
					<option value="" >所有</option>
					<c:forEach items="${subOrdination}" var="item">
						<c:choose>
							<c:when test="${query.subOrdination.id==item.id}">
						   		<option value="${item.id}" selected='selected'>${item.name}</option>
						   	</c:when> 
						   	<c:otherwise>
						   		<option value="${item.id}">${item.name}</option>
						   	</c:otherwise>  
						</c:choose>
					</c:forEach>
				</select>
			</div>
			<div>分类管理:
				<select class="select" name="classifyToManage.id">
					<option value="" >所有</option>
					<c:forEach items="${classifyToManage}" var="item">
						<c:choose>
							<c:when test="${query.classifyToManage.id==item.id}">
						   		<option value="${item.id}" selected='selected'>${item.name}</option>
						   	</c:when> 
						   	<c:otherwise>
						   		<option value="${item.id}">${item.name}</option>
						   	</c:otherwise>  
						</c:choose>
					</c:forEach>
				</select>
			</div>
			<div>机构类型:
				<select class="select" name="type">
					<option value="" >所有</option>
					<c:choose>
						<c:when test="${query.type=='branch'}">
							<option value="branch" selected='selected'>部门</option>
					   	</c:when> 
					   	<c:otherwise>
					   		<option value="branch" >部门</option>
					   	</c:otherwise>  
					</c:choose>
					<c:choose>
						<c:when test="${query.type=='unit'}">
							<option value="unit" selected='selected'>单位</option>
					   	</c:when> 
					   	<c:otherwise>
					   		<option value="unit" >单位</option>
					   	</c:otherwise>  
					</c:choose>
					<c:choose>
						<c:when test="${query.type=='group'}">
							<option value="group" selected='selected'>集团</option>
					   	</c:when> 
					   	<c:otherwise>
					   		<option value="group" >集团</option>
					   	</c:otherwise>  
					</c:choose>
				</select>
			</div>
			<div>
				<ul>
					<li class="biao5_zhong">
						<a href="#" onclick="document.forms['queryForm'].page.value=1;document.queryForm.submit();">提交</a>
					</li>
				</ul>
			</div>
		</div>	
		<!-- 标题 -->
		<div id="dataheader" class="list2_f">
			<table width="100%" border="0" cellspacing="0" cellpadding="0" style="margin-left: 5px">
              <tr class="cur">
                <td width="3%" align="center">
                	<input type='checkbox' onclick="selectReverse('checkOne')" id="ID" value=''/>
                </td>
				<td width="20%" align="left" onclick="orderby('name')">
					<nobr>机构名称</nobr>
				</td>
				<td width="10%" align="left" onclick="orderby('type')">
					<nobr>机构类型</nobr>														
				</td>													
				<td width="10%" align="left" onclick="orderby('unitNature.name')">
					<nobr>单位性质</nobr>
				</td>
				<td width="10%" align="left" onclick="orderby('subOrdination.name')">
					<nobr>隶属关系</nobr>
				</td>	
				<td width="10%" align="left" onclick="orderby('classifyToManage.name')">
					<nobr>分类管理</nobr>
				</td>
				<td width="10%" align="left" onclick="orderby('region.name')">
					<nobr>行政区域</nobr>
				</td>	
				<td width="10%" align="left" onclick="orderby('formation')">
					<nobr>编制人数</nobr>
				</td>
				<td width="10%" align="left" onclick="orderby('tel')">
					<nobr>电话</nobr>
				</td>													          
              </tr>
            </table>
		</div>
		<!-- 表体  -->
		<div id="dataList" class="list3_f">
			<c:forEach items="${pageBean.content}" var="item" varStatus="status">
				<table  width="100%" border="0" cellspacing="0" cellpadding="0">
	     			<tr id="tr${status.count}" onclick="rowclick(this)" class="list_table_tr">
						<td width="3%" align="center" height="23">
							<input id="checkOne" name="checkOne" value="${item.id}" 
							type='checkbox' onclick="dataPageCheckChange(this)"/>
						</td>						
						<td width="20%" align="left" title="${item.name}" >
							<nobr><div>																																																		
								<a href="#" onclick="enter('${item.id}');">
									${item.name}
								</a>
							</div></nobr>
						</td>																		
						<td width="10%" align="left" title="${item.typeName}">
							${item.typeName}
						</td>										
						<td width="10%" align="left" title="${item.unitNature.name}">
							${item.unitNature.name}
						</td>
						<td width="10%" align="left" title="${item.subOrdination.name}">
							${item.subOrdination.name}
						</td>
						<td width="10%" align="left" title="${item.classifyToManage.name}">
							${item.classifyToManage.name}
						</td>
						<td width="10%" align="left" title="${item.region.name}">
							${item.region.name}
						</td>
						<td width="10%" align="left" title="${item.formation}">
							${item.formation}
						</td>
						<td width="10%" align="left" title="${item.tel}">
							${item.tel}
						</td>
					</tr>
					<tr>
						<td colspan="9">
							<div style="height: 1;" class="biaotiao_xia"></div>
						</td>
					</tr>
				</table>
				
			</c:forEach>
		</div>
		<!-- 页码 --> 
		<div class="list4_f">
			<table width="100%" border="0" cellspacing="0" cellpadding="0">
				<tr>
					<td>
						<table width="100%" border="0" cellspacing="0" cellpadding="0">
							<tr valign="top">
								<td width="4" height="24" id="kj2z03" valign="bottom"></td>
								<td class="biao4_zhong" valign="bottom">
									<table width="100%" border="0" cellspacing="0"
										cellpadding="0">
										<tr>
											<td valign="bottom">
												<table align="right">
													<tr>
														<at:page />
													</tr>
												</table>
											</td>
										</tr>
									</table>
								</td>
								<td width="4" height="24" id="kj2y03" valign="bottom"></td>
							</tr>
						</table>
					</td>
				</tr>
			</table>
		</div>	
	</form>
</body>
</html>
